<?php

namespace App\Models\Advert;

use App\Models\Common\CommonModel;
use App\Models\Constant\UploadConstant;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class Advert extends CommonModel
{
    use HasFactory;

    protected $table = 'advert';

    protected $appends = ['type_name','res_type'];

    public function getTypeNameAttribute() {
        return UploadConstant::MAP_ADVERT_TYPE[$this->type]??'未知';
    }

    public function getResTypeAttribute(){
        return empty($this->origin_name)?'pic':'deo';
    }

}
